<?php
/**
 * PureMVC Port to PHP originally translated by Asbjørn Sloth Tønnesen
 *
 * @author Omar Gonzalez :: omar@almerblank.com
 * @author Hasan Otuome :: hasan@almerblank.com
 *
 * Created on Sep 24, 2008
 * PureMVC - Copyright(c) 2006-2008 Futurescale, Inc., Some rights reserved.
 * Your reuse is governed by the Creative Commons Attribution 3.0 Unported License
 */

/**
 * A base <code>IPureMVC_Mediator</code> implementation.
 *
 * @see org.puremvc.core.view.View View
 */
class PureMVC_Mediator extends PureMVC_Observer_Notifier implements PureMVC_Mediator_Interface, PureMVC_Observer_Notifier_Interface
{
	// the mediator name
	protected $mediatorName;

	// The view component
	protected $viewComponent;

	protected $_facade;

	/**
	 * The name of the <code>PureMVC_Mediator</code>.
	 *
	 * <P>
	 * Typically, a <code>PureMVC_Mediator</code> will be written to serve
	 * one specific control or group controls and so,
	 * will not have a need to be dynamically named.</P>
	 */
	const NAME = 'Mediator';

	/**
	 * Constructor.
	 */
	public function __construct( $mediatorName, $viewComponent = null )
	{
		$this->_facade = PureMVC_Facade::getInstance();
		$this->viewComponent = $viewComponent;
		$this->mediatorName = ( $mediatorName != null ) ? $mediatorName : self::NAME;
	}

	/**
	 * Get the name of the <code>PureMVC_Mediator</code>.
	 * <P>
	 * Override in subclass!</P>
	 */
	public function getMediatorName()
	{
		return $this->mediatorName;
	}

	/**
	 * Get the <code>PureMVC_Mediator</code>'s view component.
	 */
	public function getViewComponent()
	{
		return $this->viewComponent;
	}

	public function setViewComponent( $component )
	{
		$this->viewComponent = $component;
	}

	/**
	 * List the <code>PureMVC_Observer_Notification_Interface</code> names this
	 * <code>PureMVC_Mediator</code> is interested in being notified of.
	 *
	 * @return Array the list of <code>PureMVC_Observer_Notification_Interface</code> names
	 */
	public function listNotificationInterests()
	{
		return array();
	}

	/**
	 * Handle <code>PureMVC_Observer_Notification_Interface</code>s.
	 *
	 * <P>
	 * Typically this will be handled in a switch statement,
	 * with one 'case' entry per <code>PureMVC_Observer_Notification_Interface</code>
	 * the <code>PureMVC_Mediator</code> is interested in.
	 */
	public function handleNotification( PureMVC_Observer_Notification_Interface $notification )
	{

	}

	/**
	 * Called when the View registers a PureMVC_Mediator.
	 */
	public function onRegister()
	{
		return;
	}

	/**
	 * Called when the View removes a PureMVC_Mediator.
	 */
	public function onRemove()
	{
		return;
	}
}
